package com.keywaysoft.workflow.service;

import com.keywaysoft.workflow.utils.R;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author zhaojx
 */
public interface IWorkFlowService {

    /**
     * 通过bpmn文件部署流程
     *
     * @param multipartFile
     * @param name
     * @return
     */
    R uploadStreamAndDeployment(MultipartFile multipartFile, String name);

    /**
     * 通过bpmn字符串部署流程
     *
     * @param stringBPMN
     * @param name
     * @return
     */
    R addDeploymentByString(String stringBPMN, String name);

    /**
     * 获取部署列表
     *
     * @return
     */
    R getDeployments();

    /**
     * 获取流程定义
     *
     * @return
     */
    R getDefinitions();

    /**
     * 获取流程定义xml
     *
     * @param response
     * @param deploymentId
     * @param resourceName
     */
    void getProcessDefineXML(HttpServletResponse response, String deploymentId);

    /**
     * 获取流程定义图片
     *
     * @param deploymentId
     * @param response
     * @throws IOException
     */
    void getProcessDefinePng(String deploymentId, HttpServletResponse response) throws IOException;

    /**
     * 根据流程定义key挂起或者激活流程定义
     *
     * @param key
     * @return
     */
    R suspendAllProcessInstance(String key);

    /**
     * 根据流程定义ID挂起或者激活流程定义
     *
     * @param depID
     * @return
     */
    R suspendAllProcessInstanceByID(String depID);

    /**
     * 删除流程定义
     *
     * @param depID
     * @return
     */
    R delDefinition(String depID);

}
